package com.bjpowernode.money;

import com.alibaba.dubbo.config.annotation.Reference;
import com.bjpowernode.money.service.IncomeRecordService;


import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/*
   spring里面的定时器演示
 */
@Component
public class SpringTask {

    @Reference(interfaceClass = IncomeRecordService.class,version = "1.0.0",timeout = 20000)
    IncomeRecordService incomeRecordService;

    //@Scheduled(cron = "0/5 * * * * ?")
    public void test(){

        System.out.println("定时器开始。。");
        System.out.println("定时器结束。。");
    }

    @Scheduled(cron = "0/5 * * * * ?")
    public  void  generatePlan(){
        System.out.println("定时器开始");
        incomeRecordService.generatePlan();
        System.out.println("定时器结束");
    }

}
